<template>
	<view class=" mainBg h100 container">
		<navbar title="搜索"> </navbar>
		<uni-search-bar v-model="keyword" radius="50" placeholder="搜索课程" clearButton="auto" @confirm="search" />
<!-- 			<view class="list">
			<view class="title">
				热门搜索
			</view>
			<view class="col">
				<view class="item ovh">
					架构
				</view>
			</view>
			<view class="col">
				<view class="item ovh">
					架构架构架构架构架构架构架构架构架构架构架构
				</view>
			</view>
			<view class="col">
				<view class="item ovh">
					架构
				</view>
			</view>
			<view class="col">
				<view class="item ovh">
					架构
				</view>
			</view>
		</view>
		<view class="list">
			<view class="title">
				历史记录 <image src="@/static/index/del.png" mode=""></image>
			</view>
			<view class="col">
				<view class="item ovh">
					架构
				</view>
			</view>
			<view class="col">
				<view class="item ovh">
					架构架构架构架构架构架构架构架构架构架构架构
				</view>
			</view>
			<view class="col">
				<view class="item ovh">
					架构
				</view>
			</view>
			<view class="col">
				<view class="item ovh">
					架构
				</view>
			</view>
		</view> -->
		<view class="design">
			<view class="title">
				精品推荐
			</view>
			<view class="list">
				<navigator :url="`./list/detail?id=`+item.id" v-for="item in qualityList" :key="item.id">
					<view class="col">
						<item :item="item"></item>
					</view>
				</navigator>
			</view>
		</view>
		<view class="framework design">
			<view class="title">
				系列推荐
			</view>
			<view class="list">
				<navigator :url="`./list/seriesDetail?id=`+item.id" v-for="item in seriesList" :key="item.id">
					<view class="col">
						<view class="item">
							<view class="lable" v-if="item.free == 1">
								免费
							</view>
							<view class="lable" v-else>
								限时特惠
							</view>
							<view class="text">
								{{item.name}}
							</view>
							<view class="tips">
								{{item.remark}}
							</view>
							<view class="content">
								<view class="left">
									<view class="info" v-for="course,index in item.courseVoList" :key="course.id">
										<image :src="course.imageUrl" mode=""></image>
										<view>{{course.name}}</view>
									</view>
								</view>
								<view class="right">
									<text> 试听</text>
									试听2节课程
								</view>
							</view>
						</view>
					</view>
				</navigator>
			</view>
		</view>
	</view>
</template>

<script>
	import item from "./list/item.vue"
	export default {
		components: {
			item
		},
		data() {
			return {
				keyword: '',
				qualityList: [],
				seriesList: [],
			}
		},
		onLoad(option) {
			this.keyword = option.keyword
			if(this.keyword) this.search()
		},
		methods: {
			search() {
				this.$post("/common/search_data", {
					keywords: this.keyword
				}).then(res => {
					this.qualityList = res.data.qualityVosList
					this.seriesList = res.data.seriesVosList
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #35CBAD;
	}

	// .list {
	// 	display: flex;s
	// 	flex-wrap: wrap;
	// 	padding: 20rpx 0;

	// 	.title {
	// 		width: 100%;
	// 		display: flex;
	// 		justify-content: space-between;
	// 		align-items: center;
	// 		padding: 10rpx 0;

	// 		image {
	// 			width: 40rpx;
	// 			height: 40rpx;
	// 		}
	// 	}

	// 	.col {
	// 		width: calc(100%/3);
	// 		text-align: center;
	// 		padding: 10rpx;

	// 		.item {
	// 			background-color: #fff;
	// 			border-radius: 100px;
	// 			line-height: 50rpx;
	// 			font-size: 28rpx;
	// 			color: #999;
	// 			padding: 0 12rpx;
	// 		}
	// 	}
	// }

	.design {
		margin-top: 40rpx;

		.title {
			padding: 10rpx 25rpx;
			font-weight: bold;
			font-size: 36rpx;
		}

		.list {
			// background-color: rgba($color: #75F9FD, $alpha: 0.3);
			// border-radius: 20rpx;
			// padding: 1rpx 40rpx;

			.col {
				padding: 40rpx 20rpx;
				background-color: #fff;
				margin: 20rpx 0;
				border-radius: 8rpx;
				position: relative;
			}
		}
	}

	.framework {
		.item {
			padding-top: 10rpx;

			.lable {
				position: absolute;
				top: 0%;
				left: 0%;
				color: #fff;
				background-color: $assist-color2;
				font-size: 24rpx;
				line-height: 36rpx;
				width: 100rpx;
				text-align: center;
				border-radius: 8rpx 0 8rpx 0;
			}

			.text {
				font-weight: bold;
			}

			.tips {
				font-size: 24rpx;
				color: #999;
				margin: 10rpx 0;
			}

			.content {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-top: 20rpx;

				.left {
					display: flex;

					.info {
						text-align: center;
						font-size: 28rpx;
						margin-right: 40rpx;

						image {
							width: 60rpx;
							height: 60rpx;
							border-radius: 50%;
						}
					}
				}

				.right {
					text-align: right;
					color: $assist-color2;
					font-size: 24rpx;

					text {
						display: block;
						font-weight: bold;
						font-size: 28rpx;
					}
				}
			}
		}
	}
</style>